package com.lzb.compressmaster.adapter;


import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.compressmaster.R;
import com.lzb.compressmaster.basic.ProviderMultiAdapter;
import com.lzb.compressmaster.utils.ImageCompressor;

public class PicSucAdapter extends ProviderMultiAdapter<ImageCompressor.CompressResult> {


    public PicSucAdapter() {
        addItemProvider(new PicSucProvider());
    }


    private class PicSucProvider extends BaseItemProvider<ImageCompressor.CompressResult> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_pic_suc;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, ImageCompressor.CompressResult bean) {
            Glide.with(getContext()).load(bean.getOutputPath())
                    .into((ImageView) baseViewHolder.getView(R.id.ivPicSucItemImg));
        }
    }

}
